package com.visionet.school.app.web.repository.entrust;

import com.visionet.school.app.web.entity.entrust.Entrust;
import com.visionet.school.app.web.entity.entrust.vo.EntrustVo;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

/**
 * Created by hxpeng on 2017/3/2.
 */
@Repository
public interface EntrustRepository extends PagingAndSortingRepository<Entrust,String>,JpaSpecificationExecutor<Entrust> {

    PageImpl<EntrustVo> findPage(EntrustVo entrustVo, Pageable page);

    @Query("from Entrust as e where e.id = ?1 and e.isDeleted = 0 ")
    Entrust getEntrustInfo(String entrustId);

}
